package Mysql

import (
	"database/sql"
	"fmt"
	log "hello/Log"
	model "hello/models"
)

func GetCommunityList() (communityList []*model.Community, err error) {
	sqlStr := "select community_id,community_name from community"
	if err := Db.Select(&communityList, sqlStr); err != nil {
		if err == sql.ErrNoRows {
			log.Logger.Warn("there is no community in db")
			err = nil
		} else {
			log.Logger.Warn("there exists other questions")
		}

	}

	fmt.Println(communityList)
	return
}
